import ScriptVariables

######### bus creation ############
print AdminTask.createSIBus(['-bus', ScriptVariables.SIBbusName, '-busSecurity', ScriptVariables.SIBbusSecurity])
print " Created SIB successfully"
print "------------------------------------------------"

######### Bus members ############

print AdminTask.addSIBusMember(['-bus', ScriptVariables.SIBbusName, 
				'-cluster', ScriptVariables.serverClusterName, 
				'-fileStore', 
				'-logSize', 100, 
				'-logDirectory', '/Websphere/logs/scriptfilestore', 
				'-permanentStoreDirectory', '/Websphere/logs/scriptfilestore/permanent',
				'-temporaryStoreDirectory', '/Websphere/logs/scriptfilestore/temporary', 
				'-enableAssistance', 'true',
				'-policyName', 'HA'])

print " Bus member " + ScriptVariables.serverClusterName + " added"

#print AdminTask.addSIBusMember(['-bus', ScriptVariables.SIBbusName, 
#				'-cluster', ScriptVariables.serverClusterName, 
#				'-fileStore', 
#				'-logSize', 100, 
#				'-logDirectory', '/Websphere/logs/busfilestore', 
#				'-permanentStoreDirectory', '/Websphere/logs/busfilestore/permanent',
#				'-temporaryStoreDirectory', '/Websphere/logs/busfilestore/temporary', 
#				'-enableAssistance', 'true'])
#				
#print " Bus member " + ScriptVariables.serverClusterName + " added"
#print "------------------------------------------------"

######### Bus destinations ############
print AdminTask.createSIBDestination(['-bus', ScriptVariables.SIBbusName, '-name', ScriptVariables.destinationName, '-type', 'QUEUE', '-cluster', ScriptVariables.serverClusterName])
print " Bus destination " + ScriptVariables.destinationName + " added"
print "------------------------------------------------"

######### QCF creation ############
ClusterScope = AdminConfig.getid('/ServerCluster:' + ScriptVariables.serverClusterName + '/')

connFactory = AdminJMS.createSIBJMSQueueConnectionFactory(ClusterScope, 
					ScriptVariables.QueueConnFactoryName, 
					ScriptVariables.QueueConnFactoryJNDIName, 
					ScriptVariables.SIBbusName)

AdminConfig.modify(connFactory, [['connectionPool', [['maxConnections', '50'], ['connectionTimeout', '5']]]])					

print " QCF " + ScriptVariables.QueueConnFactoryName + " created"
print "------------------------------------------------"

######### OutputQueue creation ############
print AdminJMS.createSIBJMSQueue(ClusterScope, ScriptVariables.outputQueueConfigName , ScriptVariables.outputQueueJNDIName, ScriptVariables.destinationName, [['busName', ScriptVariables.SIBbusName]])
print " SIBJMSQueue " + ScriptVariables.outputQueueConfigName + " created"
print "------------------------------------------------"

######### Activation specification creation ############
print AdminJMS.createSIBJMSActivationSpec(ClusterScope, ScriptVariables.activationSpecificationName, ScriptVariables.activationSpecificationJNDIName, ScriptVariables.outputQueueJNDIName, [['busName', ScriptVariables.SIBbusName]])
print " SIBJMSActivationSpec " + ScriptVariables.activationSpecificationName + " created"
print "------------------------------------------------"

######### Saving configuration ############
print "     Saving configuration."
AdminConfig.save()
print "     Done."